home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / Sample Code / Typography Samples / Dave’s Fab Samples ƒ / Vertical Lines.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-10  |  1.4 KB  |  69 lines  |  [TEXT/KAHL]

  1. #include <Types.h>
  2. #include <QuickDraw.h>
  3. #include <Fonts.h>
  4. #include <Windows.h>
  5. #include <Menus.h>
  6. #include <SegLoad.h>
  7. #include <Memory.h>
  8. #include <Desk.h>
  9.  
  10. #include "graphics routines.h"
  11. #include "graphics libraries.h"
  12. #include "graphics toolbox.h"
  13.  
  14. #include "layout types.h"
  15. #include "layout routines.h"
  16. #include "layout library.h"
  17.  
  18. #include "SampleInterface.h"
  19.  
  20. short MyStrLen(char *x);
  21. static short MyStrLen(x)
  22. char    *x;
  23.     {
  24.     short c = 0;
  25.     while (*x++) c++;
  26.     return c;
  27.     }    /* MyStrLen */
  28.  
  29. void VerticalLines(WindowPtr sampleWindow)
  30.     {
  31.     /* Variables */
  32.     char            *myString = "Neat Text!";
  33.     gxLayoutOptions    gxLayoutOptions;
  34.     gxPoint            myPoint;
  35.     gxShape            layout;
  36.     short            len, level = 0;
  37.     gxStyle            myStyle;
  38.     gxViewPort        aViewPort;
  39.     
  40.     /* Initialization */
  41.     
  42.     myPoint.x = ff(20);
  43.     myPoint.y = ff(50);
  44.     
  45.     aViewPort = GXNewWindowViewPort(sampleWindow);
  46.     SetDefaultViewPort(aViewPort);
  47.     
  48.     len = MyStrLen(myString);
  49.     InitializeLayoutOptions(&gxLayoutOptions);
  50.     
  51.     myStyle = NewLayoutStyle((char *) "\pHelvertical", ff(40), 0, nil, nil, 0, nil);
  52.     
  53.     layout = GXNewLayout(
  54.         1, &len, (void *) &myString,
  55.         1, &len, &myStyle,
  56.         1, &len, &level,
  57.         &gxLayoutOptions, &myPoint);
  58.     GXDrawShape(layout);
  59.     
  60.     GXSetStyleTextAttributes(myStyle, gxVerticalText);
  61.     GXRotateShape(layout, ff(90), ff(0), ff(0));
  62.     GXMoveShape(layout, ff(100), ff(60));
  63.     GXDrawShape(layout);
  64.     
  65.     GXDisposeShape(layout);
  66.     GXDisposeStyle(myStyle);
  67.     GXDisposeViewPort(aViewPort);
  68.     }    /* main */
  69.